home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Sound / SndPlayDoubleBuffer / _headers / ULAW.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-15  |  3.6 KB  |  94 lines  |  [TEXT/CWIE]

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    Header containing the information needed to parse Sun's .au files.
  5. **
  6. **    by Mark Cookson, Apple Developer Technical Support
  7. **
  8. **    File:    ULAW.h
  9. **
  10. **    Copyright ©1996 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "Apple Sample
  17. **    Code" after having made changes. If you're going to re-distribute the
  18. **    source, we require that you make it clear in the source that the code
  19. **    was descended from Apple Sample Code, but that you've made changes.
  20. */
  21.  
  22. #ifndef __ULAW__
  23. #define __ULAW__
  24.  
  25. #include <Errors.h>
  26. #include <SoundComponents.h>
  27. #include <Types.h>
  28.  
  29. #ifndef __DBFFERRORS__
  30. #include "DBFF_Errors.h"
  31. #endif
  32.  
  33. #ifndef __SETUPDBHEADER__
  34. #include "SetupDBHeader.h"
  35. #endif
  36.  
  37. #ifndef __LDANDFIX__
  38. #include "LDandFix.h"
  39. #endif
  40.  
  41. #ifndef __DEFINES__
  42. #include "Defines.h"
  43. #endif
  44.  
  45. /* data format possibilities */
  46. #define SND_FORMAT_UNSPECIFIED                0        /* unspecified format (can't support this) */
  47. #define SND_FORMAT_MULAW_8                    1        /* 8-bit mu-law samples */
  48. #define SND_FORMAT_LINEAR_8                    2        /* 8-bit linear samples */
  49. #define SND_FORMAT_LINEAR_16                3        /* 16-bit linear samples */
  50. #define SND_FORMAT_LINEAR_24                4        /* 24-bit linear samples (can't support this) */
  51. #define SND_FORMAT_LINEAR_32                5        /* 32-bit linear samples (can't support this) */
  52. #define SND_FORMAT_FLOAT                    6        /* floating-point samples (can't support this) */
  53. #define SND_FORMAT_DOUBLE                    7        /* double-precision float samples (can't support this) */
  54. #define SND_FORMAT_INDIRECT                    8        /* fragmented sampled data (can't support this) */
  55. #define SND_FORMAT_NESTED                    9        /* ? (can't support this) */
  56. #define SND_FORMAT_DSP_CORE                    10        /* DSP program (can't support this) */
  57. #define SND_FORMAT_DSP_DATA_8                11        /* 8-bit fixed-point samples (can't support this) */
  58. #define SND_FORMAT_DSP_DATA_16                12        /* 16-bit fixed-point samples (can't support this) */
  59. #define SND_FORMAT_DSP_DATA_24                13        /* 24-bit fixed-point samples (can't support this) */
  60. #define SND_FORMAT_DSP_DATA_32                14        /* 32-bit fixed-point samples (can't support this) */
  61. #define SND_FORMAT_DISPLAY                    16        /* non-audio display data (can't support this, it isn't playable data anyway) */
  62. #define SND_FORMAT_MULAW_SQUELCH            17        /* ? (can't support this) */
  63. #define SND_FORMAT_EMPHASIZED                18        /* 16-bit linear with emphasis (can't support this) */
  64. #define SND_FORMAT_COMPRESSED                19        /* 16-bit linear with compression (can't support this) */
  65. #define SND_FORMAT_COMPRESSED_EMPHASIZED    20        /* A combination of the two above (can't support this) */
  66. #define SND_FORMAT_DSP_COMMANDS                21        /* Music Kit DSP commands (can't support this) */
  67. #define SND_FORMAT_DSP_COMMANDS_SAMPLES        22        /*  ? (can't support this) */
  68.  
  69. #if PRAGMA_ALIGN_SUPPORTED
  70. #pragma options align=mac68k
  71. #endif
  72.  
  73. typedef struct auHeader {
  74.     unsigned long            id;                    /* Should be '.snd' */
  75.     unsigned long            offsetToData;        /* Offset into the file to where the data is */
  76.     unsigned long            dataSize;            /* Length of data */
  77.     unsigned long            dataFormat;            /* data format code */
  78.     unsigned long            sampleRate;            /* Samples per second */
  79.     unsigned long            numChannels;        /* 1 mono, 2 stereo */
  80.     unsigned char            info[4];            /* optional text info */
  81. }auHeader;
  82.  
  83. #if PRAGMA_ALIGN_SUPPORTED
  84. #pragma options align=reset
  85. #endif
  86.  
  87.         OSErr    ASoundGetULAWHeader        (SoundInfoPtr theSoundInfo,
  88.                                         long *dataStart,
  89.                                         long *length);
  90.  
  91. #define kULAWHeaderBufferSize 24
  92.  
  93. #endif
  94.